package com.cmo.rzl.triage;

import org.beetl.sql.core.kit.StringKit;

import com.cmo.rzl.core.base.BaseController;
import com.cmo.rzl.core.jfinal.ext.autoroute.ControllerBind;
import com.cmo.rzl.core.toolbox.kit.ShardKit;
import com.cmo.rzl.shine.model.Triage;
import com.cmo.rzl.shine.service.TriageService;
import com.cmo.rzl.shine.service.impl.TriageServiceImpl;

@ControllerBind(controllerKey = "/triagecl")
public class ClientTriageController extends BaseController {

	TriageService triageservice=new TriageServiceImpl();
	ShardKit shardkit=new ShardKit();
	
	//根据登陆ip查询当前分诊台的名称
	public void findByTriageName(){
		String ip=shardkit.getIpAddr(getRequest());
		if(StringKit.isBlank(ip)){
			renderJson(error(IP_NULL_MSG));
			return;
		}
		Triage triage= triageservice.queryTriageIp(ip);
		
		if(null==triage){
			renderJson(error(QUERY_FAIL_MSG));
			return;
		}else{
			Object obj=triage.getName();
			renderJson(json(obj,QUERY_SUCCESS_MSG));
		}
		return;
	}
}
